Skip to content

Conversation

@thumbarnirmal
Copy link

…priate to the iOS documentation

@google-ml-butler google-ml-butler bot added the size:S CL Change Size: Small label May 9, 2022
@Sanjay2802
Copy link

Now cant import anything it's showing "PortAudio library not found" error while importing

@thumbarnirmal
Copy link
Author

Now cant import anything it's showing "PortAudio library not found" error while importing

Hi @Sanjay2802, is this occurring on the following branch from which I have raised PR?
branch - thumbarnirmal:master

@Sanjay2802
Copy link

Noo , i suppose

@khanhlvg
Copy link
Member

@thumbarnirmal Could you clarify what's the issue with the current code?

@Sanjay2802 The PortAudio library not found error occurs in Python's tflite-support package v0.4.0 on Linux. You can fix it by either:

  • Run sudo apt-get install libportaudio2
  • Use the nightly build of tflite-support (pip install tflite-support-nightly). The error is already fixed in master branch and will be release in the next version of tflite-support.

@thumbarnirmal
Copy link
Author

Hi @khanhlvg

The inputNode.installTap callback in AudioInputManager.swift file returns audio data in range of [100, 400] milliseconds. This is specified in the iOS documentation which can be checked in xcode. It is not specified in apple developer docs website.

When the audio data returned by installTap callback is converted and saved in pcmBuffer, the pcmBuffer will have only 400 ms of unique data. The same audio data is repeated to fill the pcmBuffer for 1 second. This can be checked by trying to match pcmBuffer array from index[0:399] and index[400:799].

Above explanation is based on the assumption that inputNode.installTap has buffersize which is greater than or equal to 400 ms. If, for example, buffer size is equivalent to 200 ms, same issue would occur, but data would repeat in pcmBuffer from index 200, 400 and so on.

@thumbarnirmal
Copy link
Author

thumbarnirmal commented May 17, 2022

When the audio data returned by installTap callback is converted and saved in pcmBuffer, the pcmBuffer will have only 400 ms of unique data. The same audio data is repeated to fill the pcmBuffer for 1 second. This can be checked by trying to match pcmBuffer array from index[0:399] and index[400:799].

For sake of brevity, I have mentioned time in milliseconds as indexing value in array. Actual array index would be calculated by multiplying the pcmBuffer's sampling rate with the time value in seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review size:S CL Change Size: Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants